//，
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.Set;
import static java.lang.Thread.sleep;
public class Test05 {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver=new ChromeDriver();
        webDriver.get("https://www.baidu.com/");
        webDriver.findElement(By.cssSelector("#s-top-left > a:nth-child(1)")).click();
        sleep(3000);
        String cur=webDriver.getWindowHandle();
        Set<String> all_handles=webDriver.getWindowHandles();
        String target="";
        for (String temp:all_handles){
            target=temp;
        }
        webDriver.switchTo().window(target);
        webDriver.findElement(By.cssSelector("#ww")).sendKeys("财经");
        sleep(3000);
        webDriver.findElement(By.cssSelector("#s_btn_wr")).click();
        webDriver.close();
    }
}
